import { network } from '@/utils';
import { GardenListParams, PostManagementParams } from './data';

import { basic } from '../../../../../config/Apis';

export async function queryPostManagementDetail(params: { id: number }) {
  return network.get(basic.posthouse, {
    params,
  });
}

export async function queryGardenList(params: GardenListParams) {
  return network.get(basic.garden_list, {
    params,
  });
}

export async function queryPosthouseTariff(params: any) {
  params.pageIndex = 1;
  params.pageSize = 1000000000;
  return network.get(basic.posthouseTariff_list, {
    params,
  });
}

export async function operSaveOrUpdate(params: PostManagementParams) {
  return params.id ? network.put(basic.posthouse, { data: params })
    : network.post(basic.posthouse, { data: params });
}

export async function operDelete(params: { id: number }) {
  return network.deleter(basic.posthouse_managr, { params });
}
